import UtilsReplace, {IUtilsReplace} from './index';

describe('UtilsReplace', () => {
    let utilsReplace: IUtilsReplace;

    beforeEach(() => {
        utilsReplace = UtilsReplace;
    });

    test('strByJson should replace placeholders with json values', () => {
        const data = 'Hello, {name}!';
        const json = {name: 'John'};

        const result = utilsReplace.strByJson(data, json);

        expect(result).toEqual('Hello, John!');
    });

    test('spliceToUrlByJson should replace placeholders with json values in url', () => {
        const url = 'https://example.com/page';
        const json = {param1: 'value1', param2: 'value2'};

        const result = utilsReplace.spliceToUrlByJson(url, json);

        expect(result).toEqual('https://example.com/page?param1=value1&param2=value2');
    });

});
